11088 - End up with more teams (DP), 11282 - Mixing invitations & 1481 - Arrange...
[and.git] / Mi manual de algoritmos / version_maraton_nacional_2008 / src / grafos / floyd.tex
bloba110da91d6c7c132d574535565cc7a1424feaa64
1 % Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
3 {\ttfamily \raggedright {
4 \noindent
5 \mbox{}\textit{\textcolor{Brown}{/*}} \\
6 \mbox{}\textit{\textcolor{Brown}{\ \ g[i][j]\ =\ Distancia\ entre\ el\ nodo\ i\ y\ el\ j.}} \\
7 \mbox{}\textit{\textcolor{Brown}{\ */}} \\
8 \mbox{}\textcolor{ForestGreen}{unsigned}\ \textcolor{ForestGreen}{long}\ \textcolor{ForestGreen}{long}\ g\textcolor{BrickRed}{[}\textcolor{Purple}{101}\textcolor{BrickRed}{][}\textcolor{Purple}{101}\textcolor{BrickRed}{];} \\
9 \mbox{} \\
10 \mbox{}\textcolor{ForestGreen}{void}\ \textbf{\textcolor{Black}{floyd}}\textcolor{BrickRed}{()}\textcolor{Red}{\{} \\
11 \mbox{}\ \ \textit{\textcolor{Brown}{//Llenar\ g}} \\
12 \mbox{}\ \ \textit{\textcolor{Brown}{//...}} \\
13 \mbox{} \\
14 \mbox{}\ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ k\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ k\textcolor{BrickRed}{$<$}n\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}k\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
15 \mbox{}\ \ \ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ i\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ i\textcolor{BrickRed}{$<$}n\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}i\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
16 \mbox{}\ \ \ \ \ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ j\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ j\textcolor{BrickRed}{$<$}n\textcolor{BrickRed}{;}\ \textcolor{BrickRed}{++}j\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
17 \mbox{}\ \ \ \ \ \ \ \ g\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}j\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{=}\ \textbf{\textcolor{Black}{min}}\textcolor{BrickRed}{(}g\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}j\textcolor{BrickRed}{],}\ g\textcolor{BrickRed}{[}i\textcolor{BrickRed}{][}k\textcolor{BrickRed}{]}\ \textcolor{BrickRed}{+}\ g\textcolor{BrickRed}{[}k\textcolor{BrickRed}{][}j\textcolor{BrickRed}{]);} \\
18 \mbox{}\ \ \ \ \ \ \textcolor{Red}{\}} \\
19 \mbox{}\ \ \ \ \textcolor{Red}{\}} \\
20 \mbox{}\ \ \textcolor{Red}{\}} \\
21 \mbox{}\ \ \textit{\textcolor{Brown}{/*}} \\
22 \mbox{}\textit{\textcolor{Brown}{\ \ \ \ Acá\ se\ cumple\ que\ g[i][j]\ =\ Longitud\ de\ la\ ruta\ más\ corta\ de\ i\ a\ j.}} \\
23 \mbox{}\textit{\textcolor{Brown}{\ \ \ */}} \\
24 \mbox{}\textcolor{Red}{\}} \\
26 } \normalfont\normalsize